package com.czp.common.action;

import com.czp.common.service.ICommonService;
import com.czp.framework.action.BaseActionSupport;
import com.czp.framework.exception.IServiceException;

/**
 * 【环 境】：J2SE 1.7
 * @author   柴志鹏	CHAIZP@GMAIL.COM
 * @version  version 1.0
 * @since    2014-8-12
 */
public class CommonAction extends BaseActionSupport {
	private static final long serialVersionUID = 7397100125015411516L;
	private ICommonService commonService;
	
	/** 
	 * 【描 述】：根据字典code前3位查询字典键值
	 */
	public void queryDictByCode() {
		try {
			String code = request.getParameter("code");
			if(code != null && !code.equals("")) {
				this.responseOutPrint(
						commonService.queryDictByCode(code));
			} else {
				this.responseOutPrint(null);
			}
		} catch(Exception e) {
			throw new IServiceException(this.getClass()+ "queryDictByCode", e);
		}
	}
	
	/** 
	 * 【描 述】：根据审核类型查询该类型下全部类型信息
	 */
	public void queryAuditTypeInfo() {
		try {
			String type = request.getParameter("type");
			if(type != null && !type.equals("")) {
				System.out.println("type: "+type);
				responseOutPrint(commonService.queryAuditTypeInfo(type));
			} else {
				responseOutPrint(null);
			}
		} catch(Exception e) {
			throw new IServiceException(getClass()+ "queryAuditType", e);
		}
	}

	/**
	 * 获取 commonService
	 * @return 返回 commonService
	 */
	public ICommonService getCommonService() {
		return commonService;
	}

	/**
	 * 设置 commonService
	 * @param 对commonService进行赋值
	 */
	public void setCommonService(ICommonService commonService) {
		this.commonService = commonService;
	}

}
